import { state } from "@angular/animations";
import { Action, createReducer, on } from "@ngrx/store";
import { decrment, increment } from "../actions/counter.actions";

export const counterFeatureKey = "counter";

export interface State {
  count: number
}

export const initialState: State = {
  count: 0
}

export const reducer = createReducer(
  initialState,
  on(increment, (state) => ({ count: state.count + 1 })),
  on(decrment, (state) => ({ count: state.count - 1 }))
)
